package com.jf.cloud.api.delivery.feign;

import com.jf.cloud.api.delivery.vo.StationVO;
import com.jf.cloud.common.feign.FeignInsideAuthConfig;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "jfcloud-delivery", contextId = "station")
public interface StationFeignClient {


    /**
     * 获取自提点信息
     *
     * @param stationId 自提点id
     * @return void
     */
    @PostMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/delivery/getStation")
    ServerResponseEntity<StationVO> getStation(@RequestParam("stationId") Long stationId);

    /**
     * 通过id获取自提门店信息（内部调用，无需token）
     *
     * @param stationId
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/delivery/getStation")
    ServerResponseEntity<StationVO> getStationByInside(@RequestParam("stationId") Long stationId);

    /**
     * 获取自提点距离
     *
     * @param lat 纬度
     * @param lng 经度
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/delivery/getStationDistance")
    ServerResponseEntity<Double> getStationDistance(@RequestParam("stationId") Long stationId, @RequestParam("lat") Double lat, @RequestParam("lng") Double lng);

}
